package com.example.gatewayzuul.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

@Service
@FeignClient(name = "permission-service",
        contextId = "permission-service-api1",
        fallback = FeignPermissionServiceFallback.class)
public interface FeignPermissionService {

    /**
     * 该方法需配合网关模块使用，该方法通过用户请求和token来检查用户拥有的所有资源(权限)
     */
    @RequestMapping(value = "/check-request", method = RequestMethod.POST)
    @ResponseBody
    public boolean checkUserRequest(@RequestHeader(value = "accessToken") String accessToken,
                                    @RequestBody String requestURI);
}
